<%- include("header",{type:''}) %>
<div class="container">
	<form style="width:100%" class="form create" method="post">
		<div>
			<label>标题：</label>
			<input placeholder="标题" type="text" name="title" value="<%- postsTitle %>">
		</div>
		<div>
			<label>内容：</label>
			<textarea name="content" id="" cols="42" rows="10"><%= postsContent %></textarea>
		</div>
		<div class="submit">修改</div>
	</form>
</div>
<script>
    $('.submit').click(()=>{
        $.ajax({
            url:'',
            data:$('.form').serialize(),
            type:"POST",
            cache:false,
            dataType:'json',
            success:function(msg){
                if(msg){
                    fade('修改成功(*^_^*)')
                    setTimeout(()=>{
                        window.location.href="/posts"
                    },1000)
                }
            },
            error:function(){
                alert('哎呀，出错啦😭')
            }
        })
    })
</script>
<% include footer %>